package com.qd.thirdpart.domain;

import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * 交投停车场同步
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@Slf4j
public class ThirdJtParkSyncDTO extends BaseQuery {

    /**
     * 主键
     */
    @NotBlank(message = "停车场唯一编码不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "停车场唯一编码长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    @JsonProperty("parkingno")
    private String parkNo;
    /**
     * 停车场名称
     */
    @NotBlank(message = "停车场名称不能为空", groups = DefaultGroup.class)
    @Size(max = 200, message = "停车场名称长度不能超过{max}位", groups = DefaultGroup.class)
    private String name;
    /**
     * 停车场地址
     */
    @NotBlank(message = "停车场地址不能为空", groups = DefaultGroup.class)
    @Size(max = 200, message = "停车场地址长度不能超过{max}位", groups = DefaultGroup.class)
    private String address;
    /**
     * 经度
     */
    @NotNull(message = "经度不能为空", groups = DefaultGroup.class)
    private BigDecimal lng;
    /**
     * 纬度
     */
    @NotNull(message = "纬度不能为空", groups = DefaultGroup.class)
    private BigDecimal lat;
    /**
     * 总车位
     */
    @NotNull(message = "总车位不能为空", groups = DefaultGroup.class)
    private Integer total;
    /**
     * 空闲状态
     */
    @NotBlank(message = "空闲状态不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "空闲状态长度不能超过{max}位", groups = DefaultGroup.class)
    @JsonProperty("free_status")
    private String freeStatus;
    /**
     * 开放时间
     */
    @NotNull(message = "开放时间不能为空", groups = DefaultGroup.class)
    @JsonProperty("service_start")
    private String serviceStart;
    /**
     * 关闭时间
     */
    @NotNull(message = "关闭时间不能为空", groups = DefaultGroup.class)
    @JsonProperty("service_end")
    private String serviceEnd;
    /**
     * 计费规则ID
     */
    @NotNull(message = "计费规则ID不能为空", groups = DefaultGroup.class)
    @JsonProperty("fee_rule_id")
    private Integer feeRuleId;
    /**
     * 转换后的经度
     */
    private BigDecimal convertLng;
    /**
     * 转换后的纬度
     */
    private BigDecimal convertLat;
    /**
     * 添加时间
     */
    private LocalDateTime addTime;
    /**
     * 添加时间
     */
    private LocalDateTime updateTime;
    /**
     * 是否转换坐标
     */
    private boolean isConvert;

    @Override
    public void freeData() {
        this.parkNo = null;
        this.name = null;
        this.address = null;
        this.lng = null;
        this.lat = null;
        this.total = null;
        this.freeStatus = null;
        this.serviceStart = null;
        this.serviceEnd = null;
        this.feeRuleId = null;
        this.convertLng = null;
        this.convertLat = null;
        this.addTime = null;
        this.updateTime = null;
        super.freeData();
    }


    public static void main(String[] args) {
        int size = 301;
        List<String> list = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            list.add("s" + i);
        }
        List<String> covertList = new LinkedList<>();
        for (int i = 0; i < size; i++) {
            covertList.add(list.get(i));
            if (i % 10 == 0) {
                log.info("{}", covertList);
                covertList.clear();
            }
        }
    }
}
